﻿function SwitchLevelType(LevelLocationType, WebpartId, PermissionCode) {
    //if (LevelLocationType == "0") {
        $("#_locationSelect").html("");
        //return;
    //}
    var filter = Portal.SODC.IDIS.Locations.ServerSideRenderFilter(LevelLocationType, WebpartId, PermissionCode).value;
    if (filter.indexOf("NONE") != -1) {
        $("#_filterpanel").html("Không có dữ liệu lọc theo cấp trên.");
        $("#_locationSelect").html(Portal.SODC.IDIS.Locations.LocationBuilder(LevelLocationType, WebpartId, PermissionCode).value);
    }
    else {
        $("#_filterpanel").html(filter);
    }
    
//    if (LevelLocationType == "0") {
//        $("#_locationSelect").html("");
//    }
//    else if (LevelLocationType == "1")
//        $("#_controlpanel").hide();
//    else
//        $("#_controlpanel").show();

    // fire event when loading done
    fireParentForm(LevelLocationType, WebpartId, PermissionCode);
}
function ShowFilterInner(ParentLocationID, LevelLocationType, WebpartId, PermissionCode) {
    $("#_locationselDistrictFilter").remove();
    var Ret = Portal.SODC.IDIS.Locations.ServerSideRenderDistrictFilter(ParentLocationID, LevelLocationType, WebpartId, PermissionCode).value;
    if (Ret.indexOf("NONE") != -1) {
        alert("Dữ liệu chưa được cấp quyền.");
        return;
    }
    $("#_filterpanel").append(Ret);
}
function FilterSelect(ParentLocationID, LevelLocationType, WebpartId, PermissionCode) {
    $("#_locationsel").remove();
    $("#_locationSelect").html("");
    $("#_locationSelect").append(Portal.SODC.IDIS.Locations.ServerSideRenderLocationsByFilter(ParentLocationID, LevelLocationType, WebpartId, PermissionCode).value);
}